//
// Created by 45512 on 2021/11/24.
//
#include <iostream>

using namespace std;
struct Point {
    int x;
    int y;
    char type;
};

int main() {
    int n, m;
    cin >> n >> m;
    Point point[n];
    for (int i = 0; i < n; i++) {
        cin >> point[i].x >> point[i].y >> point[i].type;
    }
    int list[m][3];
    for (int i = 0; i < m; i++) cin >> list[i][0] >> list[i][1] >> list[i][2];

    bool flag = 1,flag2 = 1;

    for (int i = 0; i < m; i++) {
        if ((list[i][0] + list[i][1] * point[0].x + list[i][2] * point[0].y > 0 && point[0].type == 'A') ||
            (list[i][0] + list[i][1] * point[0].x + list[i][2] * point[0].y < 0 && point[0].type == 'B')) {
            flag = 1;
        } else {
            flag = 0;
        }
        flag2 = 1;
        for (int j = 1; j < n; j++) {
            if (flag) {
                cout << "1"  << endl;
                if ((list[i][0] + list[i][1] * point[0].x + list[i][2] * point[0].y > 0 && point[0].type == 'B') ||
                    (list[i][0] + list[i][1] * point[0].x + list[i][2] * point[0].y < 0 && point[0].type == 'A')) {
                    cout << "No" << endl;
                    flag2 = 0;
                    break;
                }
            } else if (flag==0) {
                cout << "0" << endl;
                if ((list[i][0] + list[i][1] * point[0].x + list[i][2] * point[0].y > 0 && point[0].type == 'A') ||
                    (list[i][0] + list[i][1] * point[0].x + list[i][2] * point[0].y < 0 && point[0].type == 'B')) {
                    cout << "No" << endl;
                    flag2 = 0;
                    break;
                }
            }

        }
        if (flag2)
            cout << "Yes" << endl;
    }

    return 0;
}

